srcs = files(
  'src/AMDGPU/gfx908/InstructionDecoder-amdgpu-gfx908.C',
  'src/AMDGPU/gfx908/amdgpu_gfx908_decoder_impl.C',
  'src/AMDGPU/gfx908/appendOperands.C',
  'src/AMDGPU/gfx908/decodeOperands.C',
  'src/AMDGPU/gfx908/finalizeOperands.C',
  'src/AMDGPU/gfx90a/InstructionDecoder-amdgpu-gfx90a.C',
  'src/AMDGPU/gfx90a/amdgpu_gfx90a_decoder_impl.C',
  'src/AMDGPU/gfx90a/appendOperands.C',
  'src/AMDGPU/gfx90a/decodeOperands.C',
  'src/AMDGPU/gfx90a/finalizeOperands.C',
  'src/AMDGPU/gfx940/InstructionDecoder-amdgpu-gfx940.C',
  'src/AMDGPU/gfx940/amdgpu_gfx940_decoder_impl.C',
  'src/AMDGPU/gfx940/appendOperands.C',
  'src/AMDGPU/gfx940/decodeOperands.C',
  'src/AMDGPU/gfx940/finalizeOperands.C',
  'src/ArchSpecificFormatters.C',
  'src/BinaryFunction.C',
  'src/Expression.C',
  'src/Immediate.C',
  'src/Instruction.C',
  'src/InstructionAST.C',
  'src/InstructionCategories.C',
  'src/InstructionDecoder-aarch64.C',
  'src/InstructionDecoder-power.C',
  'src/InstructionDecoder-x86.C',
  'src/InstructionDecoder.C',
  'src/InstructionDecoderImpl.C',
  'src/Operand.C',
  'src/Operation.C',
  'src/Register.C',
  'src/Ternary.C',
  'src/debug.C',
  'src/interrupts.C',
  'src/syscalls.C',
)

args = ['-DINSTRUCTION_LIB']

install_headers(
  'h/ArchSpecificFormatters.h',
  'h/BinaryFunction.h',
  'h/Dereference.h',
  'h/Expression.h',
  'h/Immediate.h',
  'h/InstructionAST.h',
  'h/InstructionCategories.h',
  'h/InstructionDecoder.h',
  'h/Instruction.h',
  'h/Operand.h',
  'h/Operation_impl.h',
  'h/Register.h',
  'h/Result.h',
  'h/Ternary.h',
  'h/Visitor.h',
)

iface_deps = [common_dep, boost_dep]
instructionAPI_lib = library(
  'instructionAPI',
  srcs,
  gnu_symbol_visibility: 'inlineshidden',
  override_options: ['b_ndebug=false'],
  include_directories: include_directories(
    '..',
    'src',
    'h',
    'src/AMDGPU/gfx940',
    'src/AMDGPU/gfx90a',
    'src/AMDGPU/gfx908',
    # Comes through hacky CMake target trickery
    '../common/src',
  ),
  c_args: args,
  cpp_args: args,
  dependencies: [iface_deps],
  version: meson.project_version(),
  soversion: dyninst_soversion,
  install: true,
)
instructionapi_dep = declare_dependency(
  link_with: instructionAPI_lib,
  include_directories: include_directories('h'),
  dependencies: iface_deps,
)
all_deps += instructionapi_dep
